Nonvolatile semiconductor memory device having protection function for each memory block

ABSTRACT

A nonvolatile semiconductor memory device includes a memory cell array constituted by a plurality of memory blocks, an interface, a write circuit, and a read circuit. A protect flag is written in the memory block. The readout protect flag can be output to an external device through the interface. When a write command is input from the interface, the write circuit executes the write command when the protect flag in the selected memory block has a first value and does not execute the write command when the protect flag has a second value.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a divisional of and claims the benefit of priorityfrom U.S. application Ser. No. 12/108,272, filed Apr. 23, 2008, which isa divisional of and claims the benefit of priority from U.S. applicationSer. No. 11/387,818, filed Mar. 24, 2006, which is a continuation of PCTApplication No. PCT/JP2004/012419, filed Aug. 23, 2004, which waspublished under PCT Article 21(2) in English.

This application is based upon and claims the benefit of priority fromprior Japanese Patent Application No. 2003-336058, filed Sep. 26, 2003,the entire contents of which are incorporated herein by reference.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to an electrically programmablenonvolatile semiconductor memory device and, more particularly, to aflash memory which has a protection function of protecting each memoryblock from a rewrite or erase.

2. Description of the Related Art

A flash memory changes the threshold voltage by changing the chargeamount of the floating gate of a memory cell transistor (erase/writeoperation) and accordingly stores data. For example, a negativethreshold voltage is made to correspond to binary 1. A positivethreshold voltage is made to correspond to binary 0.

Flash memories have been developed as ROMs in which data can beelectrically rewritten. They are recently changing their position to areplacement for magnetic storage media represented by NAND flashmemories. Examples of such memory devices are a flash memory cardserving as a storage medium for a digital still camera or a flash memoryserving as a storage element for user data in a cellular phone.

In line with progress in information technology, how to ensure securityis attracting a great deal of attention. For example, a challenge inintroducing a charging/payment system using a cellular phone is toprevent any alteration of the basic information of that system. In thiscase, partial data in the NAND flash memory must be prevented from beingaltered.

In the NAND flash memory, a read/write for each page (e.g., 528 bytes)and an erase for each block (constructed by a plurality of pages) areexecuted. In a system (e.g., a memory card) using such a NAND flashmemory, file data is often managed for each memory block. For thisreason, in many NAND flash memory systems, file information in eachmemory block is read after power-on. A file management table is createdin a cache memory or the like, and then the NAND flash memory iscontrolled.

On the other hand, NOR flash memories still maintain the position ofelectrically programmable data ROMs. Some NOR flash memories have aprotection function of protecting each memory block from a write orerase. However, as blocks to be protected are actually fixed, the NORflash memories have no protection function as a replacement for magneticstorage media.

Jpn. Pat. Appln. KOKAI Publication No. 10-106275 discloses aferroelectric memory which can set write inhibition/permission for aplurality of blocks. According to this prior art, since a ROM sectionand RAM section with write protection can freely be set, any settingerror due to system runaway or the like can be prevented.

As described above, various proposals have been made for conventionalnonvolatile semiconductor memory devices to ensure security in theirmemory structures. There are however no sufficiently effective measuresin the chip size, operation speed, and convenience for users, andfurther improvement is demanded.

SUMMARY OF THE INVENTION

According to one aspect of the present invention, there is provided anonvolatile semiconductor memory device comprising a plurality of memoryblocks constituted by electrically programmable nonvolatilesemiconductor memory cells, a memory cell array constituted by theplurality of memory blocks, an interface that communicates with anexternal device, a write circuit to write data in a selected memoryblock in accordance with an address and a data write command input tothe interface, when the write command is input from the interface, thewrite circuit executing the write command when a protect flag in theselected memory block has a first value and not executing the writecommand when the protect flag has a second value, and a read circuitwhich reads, in accordance with the address input to the interface, theprotect flag that is stored in a part of the selected memory block, theprotect flag read by the read circuit being able to be output to theexternal device through the interface.

According to another aspect of the present invention, there is provideda nonvolatile semiconductor memory device comprising a plurality ofmemory blocks constituted by electrically programmable nonvolatilesemiconductor memory cells, a memory cell array constituted by theplurality of memory blocks, an interface that communicates with anexternal device, an erase circuit to erase data in a selected memoryblock in accordance with an address and an erase command input to theinterface, when the erase command is input from the interface, the erasecircuit executing the erase command when a protect flag in the selectedmemory block has a first value and not executing the erase command whenthe protect flag has a second value, and a read circuit which reads, inaccordance with the address input to the interface, the protect flagthat is stored in a part of the selected memory block, the protect flagread by the read circuit being able to be output to the external devicethrough the interface.

According to still another aspect of the present invention, there isprovided a nonvolatile semiconductor memory device comprising aplurality of memory blocks constituted by electrically programmablenonvolatile semiconductor memory cells, a memory cell array constitutedby the plurality of memory blocks, an interface that communicates withan external device, and a write circuit to write data in a selectedmemory block in accordance with an address and a data write commandinput to the interface and write a protect flag in the selected memoryblock in accordance with an address and a protect flag write commandinput to the interface, the write circuit reading the protect flag ofthe selected block before the data is written in the selected block,executing the write command when the protect flag has a first value, andnot executing the write command when the protect flag has a secondvalue.

According to still another aspect of the present invention, there isprovided a nonvolatile semiconductor memory device comprising aplurality of memory blocks constituted by electrically programmablenonvolatile semiconductor memory cells, a memory cell array constitutedby the plurality of memory blocks, an interface that communicates withan external device, an erase circuit to erase data in a selected memoryblock in accordance with an address and an erase command input to theinterface, the erase circuit reading an erase protect flag of theselected block before the data of the selected block is erased,executing the erase command when the erase protect flag has a firstvalue, and not executing the erase command when the protect flag has asecond value, and a write circuit to write the erase protect flag in theselected memory block in accordance with the address and an eraseprotect flag write command input to the interface.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram showing the structure of a flash memory as anonvolatile semiconductor memory device according to the embodiment ofthe present invention;

FIG. 2 is a circuit diagram showing the structure of the memory cellarray shown in FIG. 1;

FIG. 3 is a sectional view showing the column-direction structure of thememory cell array shown in FIG. 2;

FIGS. 4A and 4B are sectional views showing the row-direction structureof the memory cell array shown in FIG. 2;

FIG. 5 is a circuit diagram showing the arrangement of the main part ofthe column control circuit shown in FIG. 1;

FIG. 6 is a graph showing the threshold voltage distribution of a memorytransistor of the flash memory according to the embodiment of thepresent invention;

FIG. 7 is a flowchart showing the algorithm of a data write according tothe embodiment of the present invention;

FIG. 8 is a flowchart showing the algorithm of a write protect flagwrite according to the embodiment of the present invention;

FIG. 9 is a flowchart showing the algorithm of an erase protect flagwrite according to the embodiment of the present invention;

FIG. 10 is a flowchart showing the algorithm of a data protect flagwrite according to the embodiment of the present invention;

FIG. 11 is a flowchart showing the algorithm of a data erase accordingto the embodiment of the present invention;

FIG. 12 is a timing chart showing the waveforms of control signals inthe data write shown in FIG. 7;

FIG. 13 is a timing chart showing the waveforms of control signals inthe protect flag writes shown in FIGS. 8, 9, and 10;

FIG. 14 is a timing chart showing the waveforms of control signals inthe data erase shown in FIG. 11;

FIG. 15 is a timing chart showing the waveforms of control signals inerasing the protect flag as a modification of FIG. 14;

FIG. 16 is a timing chart showing the waveforms of control signals in aread according to the embodiment of the present invention;

FIG. 17 is a plan view showing the position in a block where the protectflag according to the embodiment of the present invention is written;

FIG. 18 is a block diagram showing a system which uses the flash memoryaccording to the embodiment of the present invention; and

FIG. 19 is a flowchart showing the algorithm of the protect flag erase,corresponding to FIG. 15, according to the embodiment of the presentinvention.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

FIG. 1 is a block diagram showing the structure of a flash memory as anonvolatile semiconductor memory device according to the embodiment ofthe present invention. A NAND flash memory is illustrated as an example,and a main part related to the protection function is shown.

A memory cell array 1 is constructed by arraying flash memory cells in amatrix. A column control circuit 2 is arranged adjacent to the memorycell array 1. The column control circuit 2 controls the bit lines of thememory cell array 1 to execute a data erase, data write, or data readfor the memory cells. A row control circuit 3 is arranged to select aword line of the memory cell array 1 and apply a voltage necessary forthe erase, write, or read to the word line. In addition, a source linecontrol circuit 4 which controls the source line of the memory cellarray 1 and a p-well control circuit 5 which controls the p-type well inwhich the memory cell array 1 is formed are arranged.

A data input/output buffer 6 is connected to an external host (notshown) through an I/O line to receive write data, output readout data,and receive address data or command data. The data input/output buffer 6sends received write data to the column control circuit 2 and receivesread data from the column control circuit 2. Additionally, to select amemory cell, the data input/output buffer 6 sends external address datato the column control circuit 2 or row control circuit 3 through a statemachine 8. Also, the data input/output buffer 6 sends command data fromthe host to a command interface 7.

Upon receiving a control signal from the host, the command interface 7determines whether the data input to the data input/output buffer 6 iswrite data, command data, or address data. If the data is command data,it is transferred to the state machine 8 as a receive command signal.

The state machine 8 manages the entire flash memory. The state machine 8receives a command from the host and manages the read, write, erase, anddata input/output.

FIG. 2 is a circuit diagram showing the structure of the memory cellarray 1. The memory cell array 1 is divided into a plurality of (1,024)memory blocks BLOCK0 to BLOCK1023. These blocks are minimum units for anerase. Each of the memory blocks BLOCK0 to BLOCK1023 is formed from8,512 NAND memory units, as indicated by a representative memory blockBLOCKi.

In this example, each NAND memory unit is constituted by connecting fourmemory cells M in series. One terminal of the NAND memory unit isconnected to bit lines BL (BLeO to BLe4255 and BLoO to BLo4255) througha select gate S connected to a select gate line SGD. The other terminalof the NAND memory unit is connected to a common source line C-sourcethrough the select gate S connected to a select gate line SGS. Thecontrol gate of each memory cell M is connected to a word line WL (WL0_ito WL3_i). A data write/read is executed independently for even-numberedbit lines BLe and odd-numbered bit lines BLo counted from 0. Of the8,512 memory cells connected to one word line WL, 4,256 memory cells areconnected to the even-numbered bit lines BLe, for which the datawrite/read is executed simultaneously. Data of the 4,256 memory cellseach storing 1-bit data constitute a unit called a page. Similarly,4,256 memory cells connected to the odd-numbered bit lines BLoconstitute another page. The data write/read is executed simultaneouslyfor the memory cells in the page. The 4,256 memory cells in one pagehave a storage capacity of 532 bytes. A 1-byte area (529th-byte area)stores a write protect flag. Another byte area (530th-byte area) storesan erase protect flag. In this example, a 2-byte spare area is ensuredfor replacement of defective columns. Hence, the logical page length is528 bytes.

FIG. 3 is a sectional view showing the column-direction structure of thememory cell array 1. An n-type well 10 is formed in a p-type substrate9. A p-type well 11 is formed in the n-type well 10. Each memory cell Mis constituted by a source and drain formed from n-type diffusion layers12, a floating gate FG, and a control gate CG serving as the word lineWL. The select gate S is constituted by a source and drain formed fromthe n-type diffusion layers 12 and the select gate lines SGD (SGD_0,SGD_1, . . . ) and SGS (SGS_0, . . . ) which have a double structure andact as gates. The word line WL and select gate lines SGD and SGS areconnected to the row control circuit 3 and controlled.

One terminal of the NAND memory unit is connected to a first metalinterconnection layer M0 through a first contact hole CB and thenconnected to a second metal interconnection layer M1 serving as the bitline BL through a second contact hole V1. The bit line BL is connectedto the column control circuit 2. The other terminal of the NAND memoryunit is connected to the first metal interconnection layer MO serving asthe common source line C-source through the first contact hole CB. Thecommon source line C-source is connected to the source line controlcircuit 4.

The n-type well 10 and p-type well 11 are set at an equipotential andconnected to the p-well control circuit 5 through a well line C-p-well.

FIGS. 4A and 4B are sectional views showing the row-direction structureof the memory cell array 1. FIG. 4A shows a section corresponding to thememory cells M. FIG. 4B shows a section corresponding to the select gateS. The memory cells M are separated by an element isolation structureSTI. The floating gate FG is formed on the channel region via a tunneloxide film 14. The word line WL (control gate CG) is formed on thefloating gate FG via an ONO film 15.

As shown in FIG. 4B, a select gate line SG has a double structure. Theupper and lower select gate lines SG are connected at an end of thememory cell array 1 or for every predetermined number of bit lines.

FIG. 5 shows the arrangement of the main part of the column controlcircuit 2 in the circuit shown in FIG. 1. A data storage circuit 16 isarranged for every two bit lines, i.e., the even-numbered bit line BLeand odd-numbered bit line BLo which have the same column number (e.g.,BLe5 and BLo5). One of the bit lines is selectively connected to thedata storage circuit 16 and controlled for the data write or read. Whena signal EVENBL goes high, and a signal ODDBL goes low, theeven-numbered bit line BLe is selected and connected to the data storagecircuit 16 through an NMOS transistor Qn1. When the signal EVENBL goeslow, and the signal ODDBL goes high, the odd-numbered bit line BLo isselected and connected to the data storage circuit 16 through an NMOStransistor Qn2. The signal EVENBL is common to all the even-numbered bitlines BLe. The signal ODDBL is common to all the odd-numbered bit linesBLo. Unselected bit lines BL are controlled by a circuit (not shown).

The data storage circuit 16 includes a binary data storage section DS.The data storage section DS is connected to the data input/output buffer6 through a data input/output line (I/O line) to store write data inputfrom an external device or read data to be output to an external device.The data storage section DS also stores a detection result when thethreshold voltage of the memory cell M is confirmed after the write(write verify).

FIG. 6 is a graph showing the relationship between data and thethreshold voltage of the memory cell M of the flash memory according tothis embodiment.

After the erase, the data of the memory cell M is “1”. When the writedata to the memory cell M is 0, the “1” state changes to the “0” stateby the write. When “1” data is written, the “1” state is maintained.When the threshold voltage is 0 V or less, the data is regarded as “1”in the read mode. When the threshold voltage is more than 0 V, the datais regarded as “0” in the read mode.

Table 1 indicates the voltages of various portions in the erase, write,read, and write verify modes. In this example, a word line WL1 and theeven-numbered bit line Bte are selected in the write and read modes.

TABLE 1 “0” “1” Write Erase write write Read verify BLe Floating 0 V VddH or L H or L BLo Floating Vdd Vdd   0 V   0 V SGD Floating Vdd Vdd 4.5V 4.5 V WL3 0 V 10 V  10 V 4.5 V 4.5 V WL2 0 V 10 V  10 V 4.5 V 4.5 VWL1 0 V Vpgm Vpgm   0 V 0.4 V WL0 0 V 10 V  10 V 4.5 V 4.5 V SGSFloating 0 V  0 V 4.5 V 4.5 V C-source Floating 0 V  0 V   0 V   0 VC-p-well Vera 0 V  0 V   0 V   0 V

The p-type well 11 is set to an erase voltage Vera of 20 to 21 V, andall word lines WL0 of a selected block are set to 0 V. Since electronsare discharged from the floating gate FG of the memory cell M, thethreshold voltage changes to a negative voltage so the “1” state is set.The word lines and bit lines BL of unselected blocks are set in afloating state and have a value close to Vera because of capacitivecoupling to the p-type well 11.

The write is executed by applying a write voltage Vpgm of 12 to 20 V tothe selected word line WL1. When the selected bit line BLe is set to 0V, electrons are injected to the floating gate FG, and the thresholdvoltage rises (“0” write). To inhibit the rise of the threshold voltage,the bit line BLe is set to a power supply voltage Vdd (to 3 V) (writeinhibit, “1” write).

The read is executed by applying a read voltage of 0 V to the selectedword line WL1. When the threshold voltage of the memory cell M is equalto or lower than the read voltage, the bit line BLe and common sourceline C-source are set in the conductive state, and the potential of thebit line BLe changes to relatively low level L (“1” read). When thethreshold voltage of the memory cell M is higher than the read voltage,the bit line BLe and common source line C-source are set in thenon-conductive state, and the potential of the bit line BLe changes torelatively high level H (“0” read).

The threshold voltage in the “0” state is set. to 0.4 V or more toensure a read margin of 0.4 V with respect to the read voltage of 0 V.For this reason, to write “0” data, the write verify is executed. Whenit is detected that the threshold voltage of the memory cell M hasreached 0.4 V, the write is inhibited, and the threshold voltage iscontrolled.

The write verify is executed by applying a verify voltage of 0.4 V tothe selected word line WL1. When the threshold voltage of the memorycell M is equal to or lower than the verify voltage, the bit line BLeand common source line C-source are set in the conductive state, and thepotential of the bit line BLe changes to relatively low level L. Whenthe threshold voltage of the memory cell M is higher than the verifyvoltage, the bit line BLe and common source line C-source are set in thenon-conductive state, and the potential of the bit line BLe changes torelatively high level H.

FIG. 7 shows the algorithm of a data write to the memory transistor Mconnected to the word line WL.

First, a data input command from the host is received and set in thestate machine 8 (S1). Address data from the host is received, and theaddress to select a write page is set in the state machine 8 (S2). Atthis time, all the 532 bytes of the write data of the data storagesections DS are reset to “1”s. Write data corresponding to one page (528bytes) is received, and write data corresponding to each data storagesection DS is set (S3). A write command issued by the host is receivedand set in the state machine 8 (S4). When the write command is set,steps S5 to S16 are automatically internally activated by the statemachine 8.

The page in the selected block, to which the write protect flag is to bewritten, is read (the page does not coincide with the page selected forthe write in some cases). The write protect flag corresponding to onebyte is read (S5). It is determined next whether the write protect flagis set (S6). If all the data in the memory cells M corresponding to onebyte are “0”s, it is determined that the write protect flag is set. Inthis case, steps S8 to S16 are not executed. The write command is notexecuted. The write status is set to “fail”, and the processing is ended(S7). If all the data in the memory cells M corresponding to one byteare “1”s, it is determined that no write protect flag is set. In thiscase, steps S8 to S16 are executed. When the write protect flagcorresponding to one byte contains both “1” and “0”, it is determinedthat the write protect flag is set when four or more “0” bits arepresent. In this way, an error generated in the write protect flag datais corrected in accordance with the majority theory.

When no write protect flag is set, steps S8 to S16 are executed. Theinitial value of the write voltage Vpgm is set to 12 V. A write counterPC is set to 0 (S8). When the data in the data storage section DS is“0”, the write control voltage, i.e., the voltage of the bit line BL isset to 0 V. When the data in the data storage section DS is “1”, thewrite control voltage, i.e., the voltage of the bit line BL is set toVdd because the write is inhibited (S9). A write step is executed toapply a write pulse to the memory cells of one page by using the setwrite voltage Vpgm and write control voltage (S10).

The write verify is activated (S11). Data in the data storage sectionsDS corresponding to some of the memory transistors of one page, forwhich the detection results indicate “pass”, are changed from “0” to“1”. Memory transistors whose data storage sections DS have data “1”hold “1”. It is detected whether the data in all the data storagesections DS are “1”s (S12). If YES in step S12, the write status isdetermined as “pass”, and the processing is ended (S13). Otherwise, itis determined that the write status is not “pass”. The write counter PCis checked (S14). If the value of the write counter PC is 11 or more, itis determined that the write has not been normally executed. The writestatus is set to “fail”, and the write is ended (S15). If the value ofthe write counter PC is smaller than 11, the value is incremented byone. In addition, the set value of the write voltage Vpgm is increasedby 0.8 V (S16). Step S9 and then the write step S10 are executed again.

FIG. 8 shows the algorithm of a write protect flag write to a selectedblock.

First, a write protect command from the host is received and set in thestate machine 8 (S1). A data input command from the host is received andset in the state machine 8 (S2). Address data from the host is received,and the address to select a write page is set in the state machine 8(S3). At this time, all the 532 bytes of the write data of the datastorage sections DS are reset to “1”s. Since the write protect flag iswritten in the first page of the selected block, the address is that ofthe first page of the selected block. The received page address may beneglected, and a page address may be automatically internally generatedin accordance with the write protect command. In this case, the writeprotect flag is written in the page selected by the internally generatedpage address.

A write command issued by the host is received and set in the statemachine 8 (S4). When the write command is set, steps S8 to S17 areautomatically internally activated by the state machine 8.

First, 00h (=00000000 in binary number) is set in the eight data storagesections DS of the 529th-byte area (S17). Accordingly, 00h data iswritten only in the 529th-byte area.

Next, steps S8 to S16 are executed. The initial value of the writevoltage Vpgm is set to 12 V. The write counter PC is set to 0 (S8). Whenthe data in the data storage section DS is “0”, the write controlvoltage, i.e., the voltage of the bit line BL is set to 0 V. When thedata in the data storage section DS is “1”, the write control voltage,i.e., the voltage of the bit line BL is set to Vdd because the write isinhibited (S9). A write step is executed to apply a write pulse to thememory cells of one page by using the set write voltage Vpgm and writecontrol voltage (S10).

The write verify is activated (S11). Data in the data storage sectionsDS corresponding to some of the memory transistors of one page, forwhich the detection results indicate “pass”, are changed from “0” to“1”. Memory transistors whose data storage sections DS have data “1”hold “1”. It is detected whether the data in all the data storagesections DS are “1”s (S12). If YES in step S12, the write status isdetermined as “pass”, and the processing is ended (S13). Otherwise, itis determined that the write status is not “pass”. The write counter PCis checked (S14). If the value of the write counter PC is 11 or more, itis determined that the write has not been normally executed. The writestatus is set to “fail”, and the write is ended (S15). If the value ofthe write counter PC is smaller than 11, the value is incremented byone. In addition, the set value of the write voltage Vpgm is increasedby 0.8 V (S16). Step S9 and then the write step S10 are executed again.

FIG. 9 shows the algorithm of an erase protect flag write to a selectedblock.

First, an erase protect command from the host is received and set in thestate machine 8 (S1). A data input command from the host is received andset in the state machine 8 (S2). Address data from the host is received,and the address to select a write page is set in the state machine 8(S3). At this time, all the 532 bytes of the write data of the datastorage sections DS are reset to “1”s. Since the erase protect flag iswritten in the first page of the selected block, the address is that ofthe first page of the selected block. The received page address may beneglected, and a page address may be automatically internally generatedin accordance with the erase protect command. In this case, the eraseprotect flag is written in the page selected by the internally generatedpage address.

A write command issued by the host is received and set in the statemachine 8 (S4). When the write command is set, steps S8 to S17 areautomatically internally activated by the state machine 8.

First, 00h (=00000000 in binary number) is set in the eight data storagesections DS of the 530th-byte area (S17). Accordingly, 00h data iswritten only in the 530th-byte area.

Next, steps S8 to S16 are executed. The initial value of the writevoltage Vpgm is set to 12 V. The write counter PC is set to 0 (S8). Whenthe data in the data storage section DS is “0”, the write controlvoltage, i.e., the voltage of the bit line BL is set to 0 V. When thedata in the data storage section DS is “1”, the write control voltage,i.e., the voltage of the bit line BL is set to Vdd because the write isinhibited (S9). A write step is executed to apply a write pulse to thememory cells of one page by using the set write voltage Vpgm and writecontrol voltage (S10).

The write verify is activated (S11). Data in the data storage sectionsDS corresponding to some of the memory transistors of one page, forwhich the detection results indicate “pass”, are changed from “0” to“1”. Memory transistors whose data storage sections DS have data “1”hold “1”. It is detected whether the data in all the data storagesections DS are “1”s (S12). If YES in step S12, the write status isdetermined as “pass”, and the processing is ended (S13). Otherwise, itis determined that the write status is not “pass”. The write counter PCis checked (S14). If the value of the write counter PC is 11 or more, itis determined that the write has not been normally executed. The writestatus is set to “fail”, and the write is ended (S15). If the value ofthe write counter PC is smaller than 11, the value is incremented byone. In addition, the set value of the write voltage Vpgm is increasedby 0.8 V (S16). Step S9 and then the write step S10 are executed again.

FIG. 10 shows the algorithm of a data protect flag write to a selectedblock. “Setting a data protect flag” means here setting both the writeprotect flag and erase protect flag described above.

First, a data protect command from the host is received and set in thestate machine 8 (S1). A data input command from the host is received andset in the state machine 8 (S2). Address data from the host is received,and the address to select a write page is set in the state machine 8(S3). At this time, all the 532 bytes of the write data of the datastorage sections DS are reset to “1”s. Since the data protect flag iswritten in the first page of the selected block, the address is that ofthe first page of the selected block. The received page address may beneglected, and a page address may be automatically internally generatedin accordance with the data protect command. In this case, the dataprotect flag is written in the page selected by the internally generatedpage address.

A write command issued by the host is received and set in the statemachine 8 (S4). When the write command is set, steps S8 to S17 areautomatically internally activated by the state machine 8.

First, 00h is set in each of the 16 data storage sections DS of the259th- and 530th-byte areas (S17). Accordingly, 00h data are writtenonly in the 529th- and 530th-byte areas.

Next, steps S8 to S16 are executed. The initial value of the writevoltage Vpgm is set to 12 V. The write counter PC is set to 0 (S8). Whenthe data in the data storage section DS is “0”, the write controlvoltage, i.e., the voltage of the bit line BL is set to 0 V. When thedata in the data storage section DS is “1”, the write control voltage,i.e., the voltage of the bit line BL is set to Vdd because the write isinhibited (S9). A write step is executed to apply a write pulse to thememory cells of one page by using the set write voltage Vpgm and writecontrol voltage (S10).

The write verify is activated (S11). Data in the data storage sectionsDS corresponding to some of the memory transistors of one page, forwhich the detection results indicate “pass”, are changed from “0” to“1”. Memory transistors whose data storage sections DS have data “1”hold “1”. It is detected whether the data in all the data storagesections DS are “1”s (S12). If YES in step S12, the write status isdetermined as “pass”, and the processing is ended (S13). Otherwise, itis determined that the write status is not “pass”. The write counter PCis checked (S14). If the value of the write counter PC is 11 or more, itis determined that the write has not been normally executed. The writestatus is set to “fail”, and the write is ended (S15). If the value ofthe write counter PC is smaller than 11, the value is incremented byone. In addition, the set value of the write voltage Vpgm is increasedby 0.8 V (S16). Step S9 and then the write step S10 are executed again.

FIG. 11 shows the algorithm of a data erase from the memory transistorsM of a given memory block.

First, an erase address input command from the host is received and setin the state machine 8 (S1). Address data from the host is received, andthe address to select an erase block is set in the state machine 8 (S2).When the erase command is set (S3), steps S4 to S15 are automaticallyinternally activated by the state machine 8.

The page in the selected block, to which the erase protect flag is to bewritten, is read. The erase protect flag corresponding to one byte isread (S4). It is determined next whether the erase protect flag is set(S5). If all the data in the memory cells M corresponding to one byteare “0”s, it is determined that the erase protect flag is set. In thiscase, steps S7 to S15 are not executed. The erase command is notexecuted. The erase status is set to “fail”, and the processing is ended(S6). If all the data in the memory cells M corresponding to one byteare “1”s, it is determined that no erase protect flag is set. In thiscase, steps S7 to S15 are executed. When the erase protect flagcorresponding to one byte contains both “1” and “0”, it is determinedthat the erase protect flag is set when four or more “0” bits arepresent. In this way, an error generated in the erase protect flag datais corrected in accordance with the majority theory.

When no erase protect flag is set, steps S7 to S15 are executed.

The initial value of the erase voltage Vera is set to 20 V. An erasecounter EC is set to 0 (S7). An erase step is executed to apply an erasepulse to the memory cells of one block by using the set erase voltageVera (S8).

The erase verify is activated (S9) to check whether all the memorytransistors of one block are erased. If all data are erased, writeprotect is checked in step S10. If a write protect flag is set beforethe erase, it is written back (S11). The erase status is determined as“pass”, and the processing is ended (S12).

If all the memory transistors of one block are not erased, it isdetermined that the erase status is not “pass”. The erase counter EC ischecked (S13). If the value of the erase counter EC is 3 or more, it isdetermined that the erase has not been normally executed. The erasestatus is set to “fail”, and the erase is ended (S14). If the value ofthe erase counter EC is smaller than 3, the value is incremented by one.In addition, the set value of the erase voltage Vera is increased by 0.5V (S15). The erase step S8 is executed again.

FIG. 12 shows the input/output waveforms of the interface section in thedata write corresponding to FIG. 7. Signals ALE, CLE, WEn, REn, and R/Bare connected to the command interface 7. A data input/output signal IOshas an 8-bit width and is connected to the data input/output buffer 6.

First, a data input command 80h is input to the data input/output buffer6. At this time, the data is received at the leading edge of the signalWEn and regarded as command data because the signal CLE is at H. Next,the signal ALE goes high. Address data to select a write page isreceived at the leading edge of the signal WEn. Subsequently, write datacorresponding to one page is received. When a write command 10h isinput, steps S5 to S16 shown in FIG. 7 are automatically executed. Atthis time, the command interface 7 sets the ready signal R/B low tonotify an external device that processing for the write is beinginternally executed.

After the end of the write, when a status read command 70h is input, theexternal host can read the write status. This processing is activated atthe trailing edge of the signal REn so that the write status is outputonto the data input/output signal IOs. A command FFh is a reset commandwhich initializes the flash memory of this embodiment. This command neednot always be input after the write operation.

FIG. 13 shows the input/output waveforms of the interface section in theprotect flag write corresponding to FIG. 7.

First, a protect command 4xh (x=1, 2, 3) is input. A write protect flagis 41h, an erase protect flag is 42h, and a data protect command is 43h.Next, the data input command 80h is input. Address data to select ablock to be protected is received. Subsequently, when the write command10h is input, steps S8 to S17 shown in FIG. 8, 9, or 10 areautomatically executed. At this time, the command interface 7 sets theready signal R/B low to notify an external device that processing forthe protect flag write is being internally executed.

After the end of the write, when the status read command 70h is input,the external host can read the write status. This processing isactivated at the trailing edge of the signal REn so that the writestatus is output onto the data input/output signal IOs. The command FFhis a reset command which initializes the flash memory of thisembodiment. This command need not always be input after the protect flagwrite operation.

FIG. 14 shows the input/output waveforms of the interface section in thedata erase corresponding to FIG. 11.

First, an address input command 60h is input. Address data to select ablock to be erased is received. Subsequently, when a write command D0his input, steps S4 to S13 shown in FIG. 11 are automatically executed.At this time, the command interface 7 sets the ready signal R/B low tonotify an external device that processing for the erase is beinginternally executed.

After the end of the erase, when the status read command 70h is input,the external host can read the erase status. This processing isactivated at the trailing edge of the signal REn so that the erasestatus is output onto the data input/output signal IOs. The command FFhis a reset command which initializes the flash memory of thisembodiment. This command need not always be input after the eraseoperation.

FIG. 15 shows a modification of FIG. 14 and the input/output waveformsof the interface section in the data erase. FIG. 15 shows a function oferasing the write and erase protect flags.

First, a protect flag erase command 2Dh is input. The address inputcommand 60h is input. Address data to select a block to be erased isreceived. Subsequently, when the write command D0h is input, steps S4 toS15 shown in FIG. 11 are automatically executed. After input of theerase command D0h, steps S4 to S6 are omitted so that the processingjumps to step S7. The processing advances from step S9 to step S12 orS13 directly in accordance with determination. FIG. 19 shows thealgorithm without steps S4, S5, S6, S10, and S11.

The command interface 7 sets the ready signal RIB low to notify anexternal device that processing for the erase is being internallyexecuted. After the end of the erase, when the status read command 70his input, the external host can read the erase status. This processingis activated at the trailing edge of the signal REn so that the erasestatus is output onto the data input/output signal IOs. The command FFhis a reset command which initializes the flash memory of thisembodiment. This command need not always be input after the eraseoperation.

FIG. 16 shows the input/output waveforms of the interface section so asto explain the data read and the protect flag read.

Address data of a page to be selected is received. After that, thecommand interface 7 sets the ready signal R/B low. During this time, thedata of the selected page are automatically read to the data storagecircuits DS at once and temporarily stored. If the 529th- and 530th-byteareas of the selected page are protect flag storage areas, errorcorrection for each protect flag is executed in accordance with themajority theory.

By toggling the signal REn, the external host can receive the data readout from the data storage circuit DS. If the 529th- and 530th-byte areasof the selected page are protect flag storage areas, the external hostcan know whether the protect flag is set, by inputting a protect statusread command 74h. For example, when the signal names of the 8-bit datainput/output signal IOs are defined as IO0, IO1, IO2, IO3, IO4, IO5,IO6, and IO7, each state is expressed in the following way. (1) Whenonly the write protect flag is set IO0, IO1, IO2, IO3, IO4, IO5, IO6,IO7=10000000 (2) When only the erase protect flag is set IO0, IO1, IO2,IO3, IO4, IO5, IO6, IO7=01000000 (3) When both the write and eraseprotect flags are set IO0, IO1, IO2, IO3, IO4, IO5, IO6, IO7=11000000

In this way, the external host can detect the block with the set protectflag.

FIG. 17 shows the logical position in each block where the protect flagis stored. Each block is constructed by eight pages. A protect flag isstored in each of the 529th- and 530th-byte areas of the first page page0. The page need not always be the first page. A final page page 7 or apage page 3 may be used.

FIG. 18 shows an example of a memory system which uses a flash memory102 according to this embodiment. A control system 101 controls aplurality of flash memories 102 (102_1 to 102_4). The control system 101may be either a semiconductor chip of certain type or a software driverof certain type. After power-on, the control system 101 reads out theprotect flag of each block of each flash memory 102. The information isstored in a cache memory 103 in the control system 101. The controlsystem 101 controls the flash memories 102 through an informationinput/output path 104 by using the protect flag information in the cachememory 103.

For example, the personal information of the user of the memory systemis stored in the flash memory 102_1. The user instructs the memorysystem not to alter the information. The control system 101 sets a writeor erase protect flag in the block of the flash memory 102_1 where thepersonal information is stored. When the system is powered next, thecontrol system reads out the flag to detect the write- orerase-inhibited block. The memory system is operated using the remainingblocks. The memory system can be initialized by using the protect flagerase command 2Dh.

A nonvolatile semiconductor memory device according to the embodiment ofthe present invention comprises a plurality of memory blocks (BLOCK)constituted by electrically programmable nonvolatile semiconductormemory cells (M), a memory cell array (1) constituted by the pluralityof memory blocks, an interface (6, 7) that communicates with an externaldevice, a write circuit (2, 3, 4, 5, 8) to write data in a selectedmemory block in accordance with an address and a data write commandinput to the interface, and a read circuit (2, 3, 4, 5, 8) which reads,in accordance with the address input to the interface, a protect flagthat is stored in a part of the selected memory block. The protect flagread by the read circuit can be output to the external device throughthe interface. When the write command is input from the interface, thewrite circuit executes the write command when the protect flag in theselected memory block has a first value and does not execute the writecommand when the protect flag has a second value.

Preferred embodiments of the present invention are as follows.

(1) The protect flag is stored in a plurality of memory cells in eachmemory block, and when the protect flag is read, error correction isexecuted in accordance with a majority theory.

(2) The write circuit writes the protect flag in the part of theselected memory block in accordance with the address and a protect flagwrite command input to the interface.

A nonvolatile semiconductor memory device according to the embodiment ofthe present invention comprises a plurality of memory blocks (BLOCK)constituted by electrically programmable nonvolatile semiconductormemory cells (M), a memory cell array (1) constituted by the pluralityof memory blocks, an interface (6, 7) that communicates with an externaldevice, an erase circuit (2, 3, 4, 5, 8) to erase data in a selectedmemory block in accordance with an address and an erase command input tothe interface, and a read circuit (2, 3, 4, 5, 8) which reads, inaccordance with the address input to the interface, a protect flag thatis stored in a part of the selected memory block. The protect flag readby the read circuit can be output to the external device through theinterface. When the erase command is input from the interface, the erasecircuit executes the erase command when the protect flag in the selectedmemory block has a first value and does not execute the erase commandwhen the protect flag has a second value.

Preferred embodiments of the present invention are as follows.

(1) The protect flag is stored in a plurality of memory cells in eachmemory block, and when the protect flag is read, error correction isexecuted in accordance with a majority theory.

(2) The device further comprises a write circuit which writes theprotect flag in the part of the selected memory block in accordance withthe address and a protect flag write command input to the interface.

A nonvolatile semiconductor memory device according to the embodiment ofthe present invention comprises a plurality of memory blocks (BLOCK)constituted by electrically programmable nonvolatile semiconductormemory cells (M), a memory cell array (1) constituted by the pluralityof memory blocks, an interface (6, 7) that communicates with an externaldevice, and a write circuit (2, 3, 4, 5, 8) to write data in a selectedmemory block in accordance with an address and a data write commandinput to the interface and write a protect flag in the selected memoryblock in accordance with an address and a protect flag write commandinput to the interface. The write circuit reads the protect flag of theselected block before the data is written in the selected block,executes the write command when the protect flag has a first value, anddoes not execute the write command when the protect flag has a secondvalue.

Preferred embodiments of the present invention are as follows.

(1) The protect flag is stored in a plurality of memory cells in eachmemory block, and when the protect flag is read, error correction isexecuted in accordance with a majority theory.

A nonvolatile semiconductor memory device according to the embodiment ofthe present invention comprises a plurality of memory blocks (BLOCK)constituted by electrically programmable nonvolatile semiconductormemory cells (M), a memory cell array (1) constituted by the pluralityof memory blocks, an interface (6, 7) that communicates with an externaldevice, an erase circuit (2, 3, 4, 5, 8) to erase data in a selectedmemory block in accordance with an address and an erase command input tothe interface, and a write circuit (2, 3, 4, 5, 8) to write the eraseprotect flag in the selected memory block in accordance with the addressand an erase protect flag write command input to the interface. Theerase circuit reads an erase protect flag of the selected block beforethe data of the selected block is erased, executes the erase commandwhen the erase protect flag has a first value, and does not executes theerase command when the protect flag has a second value.

Preferred embodiments of the present invention are as follows.

(1) The erase protect flag is stored in a plurality of memory cells ineach memory block, and when the erase protect flag is read, errorcorrection is executed in accordance with a majority theory.

(2) The write circuit writes a write protect flag in the selected memoryblock in accordance with the address and a write protect flag writecommand input to the interface, and writes back the write protect flagafter the erase command is executed.

(3) The write protect flag is stored in a plurality of memory cells ineach memory block, and when the write protect flag is read, errorcorrection is executed in accordance with a majority theory.

As described above, according to the embodiment of the presentinvention, the protection function of protecting data from the write orerase can be controlled for each memory block. In addition, since thetype of protection and the position of the block where the protect flagis set can be read to the outside, the block can easily be managed.Furthermore, the protection function can be disabled. Hence, a flashmemory which can be applied to various memory systems can be provided.

Since the presence/absence of protection is set by setting the protectflag in each block, the chip size does not increase. Address comparisonfor checking whether an address is protected need not be executed everytime the memory is accessed. Hence, the access speed does not decrease.

Accordingly, a nonvolatile semiconductor memory device can be provided,which serves as a flash memory that can be regarded as a replacement fora magnetic storage medium, has a protection function of protecting eachmemory block from a write or erase, and can increase the convenience forusers.

In the above embodiment, a NAND flash memory has been described as anexample of a nonvolatile semiconductor memory device. However, thepresent invention can also be applied to a semiconductor integratedcircuit device in which a NAND flash memory and logic circuit areembedded, or a semiconductor integrated circuit device called a SOC inwhich a system is formed in one chip. The present invention can also beapplied to an IC card or memory card in which the nonvolatilesemiconductor memory device is mounted on a card-shaped package orvarious memory systems such as a system using the memory card.

As described above, according to one aspect of this invention, anonvolatile semiconductor memory device can be provided, which has aprotection function of protecting an arbitrarily selected block from awrite or erase without increasing the chip size or decreasing the accessspeed and can increase the convenience for users.

Additional advantages and modifications will readily occur to thoseskilled in the art. Therefore, the invention in its broader aspects isnot limited to the specific details and representative embodiments shownand described herein. Accordingly, various modifications may be madewithout departing from the spirit or scope of the general inventiveconcept as defined by the appended claims and their equivalents.

1. A nonvolatile semiconductor memory device comprising: a plurality ofmemory blocks constituted by electrically programmable nonvolatilesemiconductor memory cells; a memory cell array constituted by theplurality of memory blocks; an interface that communicates with anexternal device; and a write circuit to write data in a selected memoryblock in accordance with an address and a data write command input tothe interface and write a protect flag in the selected memory block inaccordance with an address and a protect flag write command input to theinterface, the write circuit reading the protect flag of the selectedblock before the data is written in the selected block, executing thewrite command when the protect flag has a first value, and not executingthe write command when the protect flag has a second value.
 2. A deviceaccording to claim 1, wherein the protect flag is stored in a pluralityof memory cells in each memory block, and when the protect flag is read,error correction is executed in accordance with a majority theory.
 3. Adevice according to claim 1, wherein each of said plurality of memoryblocks includes a plurality of NAND-type memory units.
 4. A deviceaccording to claim 3, wherein each of said plurality of NAND-type memoryunits includes a plurality of memory cells connected in series.
 5. Adevice according to claim 1, wherein each of said plurality of memoryblocks includes a plurality of pages, an erase operation is executed inunits of blocks and a read/write operation is executed in units ofpages.
 6. A device according to claim 5, wherein the protect flag isstored in a first page of said plurality of pages.
 7. A device accordingto claim 1, wherein: each of said plurality of memory blocks includes aplurality of NAND-type memory units each including a plurality of memorycells connected in series; each of said plurality of memory blocksincludes a plurality of pages, an erase operation is executed in unitsof blocks, and a read/write operation is executed in units of pages; andthe protect flag is stored in a first page of said plurality of pages.8. A device according to claim 1, wherein each of said plurality ofmemory blocks includes a plurality of pages, an erase operation isexecuted in units of blocks, and a read/write operation is executed inunits of pages, and the protect flag is stored in a last page of saidplurality of pages.
 9. A device according to claim 8, wherein theprotect flag is stored in a plurality of memory cells in each memoryblock, and when the protect flag is read, error correction is executedin accordance with a majority theory.
 10. A device according to claim 8,wherein each of said plurality of memory blocks includes a plurality ofNAND-type memory units.
 11. A device according to claim 10, wherein eachof said plurality of NAND-type memory units includes a plurality ofmemory cells connected in series.
 12. A device according to claim 1,wherein: each of said plurality of memory blocks includes a plurality ofNAND-type memory units each including a plurality of memory cellsconnected in series; each of said plurality of memory blocks includes aplurality of pages, an erase operation is executed in units of blocks,and a read/write operation is executed in units of pages; and theprotect flag is stored in a last page of said plurality of pages.